package com.cloud.job.project.service.impl;

import com.cloud.job.project.mapper.QuartzJobMapper;
import com.cloud.job.project.model.entity.QuartzJob;
import com.cloud.job.project.service.IQuartzJobService;
import com.cloud.job.project.service.ITestService;
import io.seata.core.context.RootContext;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 * Test 服务实现类
 * </p>
 *
 * @author Sam
 * @since 2021-05-17
 */
@Slf4j
@Service
public class TestServiceImpl implements ITestService {

    @Resource
    private QuartzJobMapper quartzJobMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void seataReduceStore() {
        String xid = RootContext.getXID();
        log.info("JOB New Transaction Begins: " + xid);
        quartzJobMapper.reduceStore("1", 1);
    }
}
